package com.zshan.clinic.admin.mapper.config;


import com.zshan.clinic.admin.entity.dto.ClinicEmpScheduleDTO;
import com.zshan.clinic.admin.entity.vo.ClinicEmpSchedulePageVo;
import com.zshan.clinic.admin.entity.vo.ClinicEmpScheduleVo;
import com.zshan.clinic.database.model.ClinicEmpScheduleDetail;
import com.zshan.clinic.mybatis.SuperMapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

public interface SpecEmpScheduleMapper extends SuperMapper {

    /**
     * 查询排班
     * @param clinicId
     * @param startDate
     * @param endDate
     * @param empName
     * @param deptId
     * @return
     */
    Long getEmpScheduleCount(@Param("clinicId") Long clinicId,
                             @Param("startDate") LocalDate startDate,
                             @Param("endDate") LocalDate endDate,
                             @Param("empName") String empName,
                             @Param("deptId") Long deptId);

    /**
     * 查询排班
     * @param clinicId
     * @param startDate
     * @param endDate
     * @param empName
     * @param deptId
     * @param offset
     * @param limit
     * @return
     */
    List<ClinicEmpSchedulePageVo> getEmpScheduleList(@Param("clinicId") Long clinicId,
                                                     @Param("startDate") LocalDate startDate,
                                                     @Param("endDate") LocalDate endDate,
                                                     @Param("empName") String empName,
                                                     @Param("deptId") Long deptId,
                                                     @Param("offset") Integer offset,
                                                     @Param("limit") Integer limit);


    /**
     * 复制排班用
     * @param clinicId
     * @param deptIdList
     * @param fromStart
     * @param fromEnd
     * @return
     */
    List<ClinicEmpScheduleDTO> getFormScheduleList(@Param("clinicId") Long clinicId,
                                                   @Param("deptIdList") List<Long> deptIdList,
                                                   @Param("fromStart") LocalDate fromStart,
                                                   @Param("fromEnd") LocalDate fromEnd);

    /**
     * 获取排班明细，保存排班用
     * @param clinicId
     * @param empId
     * @param workDate
     * @return
     */
    ClinicEmpScheduleDTO getScheduleDetail(@Param("clinicId") Long clinicId,
                                           @Param("empId") Long empId,
                                           @Param("workDate") LocalDate workDate);

    /**
     * 批量添加排班
     * @param copyScheduleList
     */
    void addScheduleBatch(@Param("scheduleList") List<ClinicEmpScheduleDTO> copyScheduleList);

    /**
     * 添加排班明细
     * @param detailList
     */
    void addScheduleDetailsBatch(@Param("detailList") List<ClinicEmpScheduleDetail> detailList);

    /**
     * 查询员工个人排班
     * @param empId
     * @param startDate
     * @param endDate
     * @return
     */
    List<ClinicEmpScheduleVo> getMySchedule(@Param("clinicId") Long clinicId,
                                            @Param("empId") Long empId,
                                            @Param("startDate") LocalDate startDate,
                                            @Param("endDate") LocalDate endDate);

    /**
     * 查询排班
     * @param clinicId
     * @param shiftId
     * @return
     */
    List<String> getScheduleIdList(@Param("clinicId")Long clinicId, @Param("shiftId") Long shiftId);
}
